<template>
	<view class="business">
		<view class="businessbox">
			<view class="address">
				当前位置：{{address}}
			</view>
			<view class="businesslist" v-for="(item,index) in list" :key="item.id">
				<view class="b_item" @click="toPage('../../detail/premium?offid=' + item.id)">
					<image :src="item.img | getImg" mode=""></image>
					<view class="infobox">
						<view class="name">
							{{item.shop_name}}
						</view>
						<view class="gap">
							{{item.distance}}
						</view>
						<view class="address_name">
							{{item.shop_address}}
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		ShopClass
	} from "@/api/api.js"
	export default {
		data() {
			return {
				list: [],
				id: '',
				address: ''
			}
		},
		onLoad(e) {

			this.address = uni.getStorageSync('nowAddress').address
			this.id = e.offid
			this.ShopClass()
		},
		methods: {
			ShopClass() {
				ShopClass({
					off_class_id: this.id
				}).then(res => {
					console.log(res);
					this.list = res.data.shop_list
				})
			},
			toPage(url) {
				uni.navigateTo({
					url
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: #f3f3f3;
	}

	.businessbox {
		background: #fff;
		margin-top: 10px;
		padding: 10px;

		.address {
			font-size: 14px;
			padding-bottom: 10px;
			border-bottom: 5px solid #f3f3f3;
		}

		.b_item {
			display: flex;
			align-items: center;
			padding: 10px 0;

			image {
				height: 80px;
				width: 80px;
			}

			.infobox {
				margin-left: 10px;

				.gap,
				.address_name {
					font-size: 14px;
					color: #777;
					margin-top: 5px;
				}
			}
		}
	}

	.navList {
		display: table;
		background-color: #fff;
		width: 100%;

		.navitem {
			float: left;
			width: 20%;
			text-align: center;
			padding: 10px 5px;
			box-sizing: border-box;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			font-size: 14px;

			image {
				width: 50px;
				height: 50px;
				border-radius: 50%;
			}
		}

		.active {
			color: #FF5555;
			border-bottom: 2px solid #FF5555;
		}
	}
</style>
